\(\int \cos (e+f x) (a+a \sec (e+f x))^m \, dx\) [346]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (warning: unable to verify)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 19, antiderivative size = 84 \[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=-\frac {\sqrt {2} \operatorname {AppellF1}\left (\frac {1}{2}+m,\frac {1}{2},2,\frac {3}{2}+m,\frac {1}{2} (1+\sec (e+f x)),1+\sec (e+f x)\right ) (a+a \sec (e+f x))^m \tan (e+f x)}{f (1+2 m) \sqrt {1-\sec (e+f x)}} \]

[Out]

-AppellF1(1/2+m,2,1/2,3/2+m,1+sec(f*x+e),1/2+1/2*sec(f*x+e))*(a+a*sec(f*x+e))^m*2^(1/2)*tan(f*x+e)/f/(1+2*m)/(
1-sec(f*x+e))^(1/2)

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3913, 3912, 141} \[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=-\frac {\sqrt {2} \tan (e+f x) (a \sec (e+f x)+a)^m \operatorname {AppellF1}\left (m+\frac {1}{2},\frac {1}{2},2,m+\frac {3}{2},\frac {1}{2} (\sec (e+f x)+1),\sec (e+f x)+1\right )}{f (2 m+1) \sqrt {1-\sec (e+f x)}} \]

[In]

Int[Cos[e + f*x]*(a + a*Sec[e + f*x])^m,x]

[Out]

-((Sqrt[2]*AppellF1[1/2 + m, 1/2, 2, 3/2 + m, (1 + Sec[e + f*x])/2, 1 + Sec[e + f*x]]*(a + a*Sec[e + f*x])^m*T
an[e + f*x])/(f*(1 + 2*m)*Sqrt[1 - Sec[e + f*x]]))

Rule 141

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_))^(p_), x_Symbol] :> Simp[(b*e - a*f
)^p*((a + b*x)^(m + 1)/(b^(p + 1)*(m + 1)*(b/(b*c - a*d))^n))*AppellF1[m + 1, -n, -p, m + 2, (-d)*((a + b*x)/(
b*c - a*d)), (-f)*((a + b*x)/(b*e - a*f))], x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] &&  !IntegerQ[m] &&  !Int
egerQ[n] && IntegerQ[p] && GtQ[b/(b*c - a*d), 0] &&  !(GtQ[d/(d*a - c*b), 0] && SimplerQ[c + d*x, a + b*x])

Rule 3912

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_Symbol] :> Dist[a^2*d
*(Cot[e + f*x]/(f*Sqrt[a + b*Csc[e + f*x]]*Sqrt[a - b*Csc[e + f*x]])), Subst[Int[(d*x)^(n - 1)*((a + b*x)^(m -
 1/2)/Sqrt[a - b*x]), x], x, Csc[e + f*x]], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 - b^2, 0] &&  !In
tegerQ[m] && GtQ[a, 0]

Rule 3913

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_Symbol] :> Dist[a^Int
Part[m]*((a + b*Csc[e + f*x])^FracPart[m]/(1 + (b/a)*Csc[e + f*x])^FracPart[m]), Int[(1 + (b/a)*Csc[e + f*x])^
m*(d*Csc[e + f*x])^n, x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 - b^2, 0] &&  !IntegerQ[m] &&  !GtQ
[a, 0]

Rubi steps \begin{align*} \text {integral}& = \left ((1+\sec (e+f x))^{-m} (a+a \sec (e+f x))^m\right ) \int \cos (e+f x) (1+\sec (e+f x))^m \, dx \\ & = -\frac {\left ((1+\sec (e+f x))^{-\frac {1}{2}-m} (a+a \sec (e+f x))^m \tan (e+f x)\right ) \text {Subst}\left (\int \frac {(1+x)^{-\frac {1}{2}+m}}{\sqrt {1-x} x^2} \, dx,x,\sec (e+f x)\right )}{f \sqrt {1-\sec (e+f x)}} \\ & = -\frac {\sqrt {2} \operatorname {AppellF1}\left (\frac {1}{2}+m,\frac {1}{2},2,\frac {3}{2}+m,\frac {1}{2} (1+\sec (e+f x)),1+\sec (e+f x)\right ) (a+a \sec (e+f x))^m \tan (e+f x)}{f (1+2 m) \sqrt {1-\sec (e+f x)}} \\ \end{align*}

Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(3781\) vs. \(2(84)=168\).

Time = 17.47 (sec) , antiderivative size = 3781, normalized size of antiderivative = 45.01 \[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=\text {Result too large to show} \]

[In]

Integrate[Cos[e + f*x]*(a + a*Sec[e + f*x])^m,x]

[Out]

(2^(1 + m)*Cos[(e + f*x)/2]^3*Cos[e + f*x]*(Cos[(e + f*x)/2]^2*Sec[e + f*x])^m*(a*(1 + Sec[e + f*x]))^m*Sin[(e
 + f*x)/2]*((-3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2)/(3*Appel
lF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - 2*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2,
 -Tan[(e + f*x)/2]^2] - m*AppellF1[3/2, 1 + m, 1, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)
/2]^2) + (2*AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])/(AppellF1[1/2, m, 2, 3/2, Tan[(
e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + (2*(-2*AppellF1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]
 + m*AppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)/3)))/(f*(2^m*C
os[(e + f*x)/2]^4*(Cos[(e + f*x)/2]^2*Sec[e + f*x])^m*((-3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(
e + f*x)/2]^2]*Sec[(e + f*x)/2]^2)/(3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - 2*(A
ppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - m*AppellF1[3/2, 1 + m, 1, 5/2, Tan[(e + f*x
)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2) + (2*AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e +
f*x)/2]^2])/(AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + (2*(-2*AppellF1[3/2, m, 3, 5/
2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + m*AppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x
)/2]^2])*Tan[(e + f*x)/2]^2)/3)) - 3*2^m*Cos[(e + f*x)/2]^2*(Cos[(e + f*x)/2]^2*Sec[e + f*x])^m*Sin[(e + f*x)/
2]^2*((-3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2)/(3*AppellF1[1/
2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - 2*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[
(e + f*x)/2]^2] - m*AppellF1[3/2, 1 + m, 1, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)
 + (2*AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])/(AppellF1[1/2, m, 2, 3/2, Tan[(e + f*
x)/2]^2, -Tan[(e + f*x)/2]^2] + (2*(-2*AppellF1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + m*A
ppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)/3)) + 2^(1 + m)*Cos[
(e + f*x)/2]^3*(Cos[(e + f*x)/2]^2*Sec[e + f*x])^m*Sin[(e + f*x)/2]*((-3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x
)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/(3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]
^2, -Tan[(e + f*x)/2]^2] - 2*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - m*AppellF1[3
/2, 1 + m, 1, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2) - (3*Sec[(e + f*x)/2]^2*(-1/3
*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2]) + (m*
AppellF1[3/2, 1 + m, 1, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3))
/(3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - 2*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f
*x)/2]^2, -Tan[(e + f*x)/2]^2] - m*AppellF1[3/2, 1 + m, 1, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[
(e + f*x)/2]^2) + (2*((-2*AppellF1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2
*Tan[(e + f*x)/2])/3 + (m*AppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/
2]^2*Tan[(e + f*x)/2])/3))/(AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + (2*(-2*AppellF
1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + m*AppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2
, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)/3) + (3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x
)/2]^2]*Sec[(e + f*x)/2]^2*(-2*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - m*AppellF1
[3/2, 1 + m, 1, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2] + 3*(-1/3*(
AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2]) + (m*Ap
pellF1[3/2, 1 + m, 1, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3) -
2*Tan[(e + f*x)/2]^2*((-6*AppellF1[5/2, m, 3, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2
*Tan[(e + f*x)/2])/5 + (3*m*AppellF1[5/2, 1 + m, 2, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x
)/2]^2*Tan[(e + f*x)/2])/5 - m*((-3*AppellF1[5/2, 1 + m, 2, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[
(e + f*x)/2]^2*Tan[(e + f*x)/2])/5 + (3*(1 + m)*AppellF1[5/2, 2 + m, 1, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x
)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5))))/(3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f
*x)/2]^2] - 2*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - m*AppellF1[3/2, 1 + m, 1, 5
/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)^2 - (2*AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x
)/2]^2, -Tan[(e + f*x)/2]^2]*((-2*AppellF1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f
*x)/2]^2*Tan[(e + f*x)/2])/3 + (m*AppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e
 + f*x)/2]^2*Tan[(e + f*x)/2])/3 + (2*(-2*AppellF1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] +
m*AppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/
3 + (2*Tan[(e + f*x)/2]^2*(-2*((-9*AppellF1[5/2, m, 4, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e +
f*x)/2]^2*Tan[(e + f*x)/2])/5 + (3*m*AppellF1[5/2, 1 + m, 3, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec
[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5) + m*((-6*AppellF1[5/2, 1 + m, 3, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/
2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5 + (3*(1 + m)*AppellF1[5/2, 2 + m, 2, 7/2, Tan[(e + f*x)/2]^2, -Ta
n[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5)))/3))/(AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/2]^2,
-Tan[(e + f*x)/2]^2] + (2*(-2*AppellF1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + m*AppellF1[3
/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)/3)^2) + 2^(1 + m)*m*Cos[(e +
f*x)/2]^3*(Cos[(e + f*x)/2]^2*Sec[e + f*x])^(-1 + m)*Sin[(e + f*x)/2]*((-3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f
*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2)/(3*AppellF1[1/2, m, 1, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f
*x)/2]^2] - 2*(AppellF1[3/2, m, 2, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - m*AppellF1[3/2, 1 + m, 1, 5
/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2) + (2*AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/
2]^2, -Tan[(e + f*x)/2]^2])/(AppellF1[1/2, m, 2, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + (2*(-2*Appell
F1[3/2, m, 3, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + m*AppellF1[3/2, 1 + m, 2, 5/2, Tan[(e + f*x)/2]^
2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)/3))*(-(Cos[(e + f*x)/2]*Sec[e + f*x]*Sin[(e + f*x)/2]) + Cos[(e +
 f*x)/2]^2*Sec[e + f*x]*Tan[e + f*x])))

Maple [F]

\[\int \cos \left (f x +e \right ) \left (a +a \sec \left (f x +e \right )\right )^{m}d x\]

[In]

int(cos(f*x+e)*(a+a*sec(f*x+e))^m,x)

[Out]

int(cos(f*x+e)*(a+a*sec(f*x+e))^m,x)

Fricas [F]

\[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=\int { {\left (a \sec \left (f x + e\right ) + a\right )}^{m} \cos \left (f x + e\right ) \,d x } \]

[In]

integrate(cos(f*x+e)*(a+a*sec(f*x+e))^m,x, algorithm="fricas")

[Out]

integral((a*sec(f*x + e) + a)^m*cos(f*x + e), x)

Sympy [F]

\[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=\int \left (a \left (\sec {\left (e + f x \right )} + 1\right )\right )^{m} \cos {\left (e + f x \right )}\, dx \]

[In]

integrate(cos(f*x+e)*(a+a*sec(f*x+e))**m,x)

[Out]

Integral((a*(sec(e + f*x) + 1))**m*cos(e + f*x), x)

Maxima [F]

\[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=\int { {\left (a \sec \left (f x + e\right ) + a\right )}^{m} \cos \left (f x + e\right ) \,d x } \]

[In]

integrate(cos(f*x+e)*(a+a*sec(f*x+e))^m,x, algorithm="maxima")

[Out]

integrate((a*sec(f*x + e) + a)^m*cos(f*x + e), x)

Giac [F]

\[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=\int { {\left (a \sec \left (f x + e\right ) + a\right )}^{m} \cos \left (f x + e\right ) \,d x } \]

[In]

integrate(cos(f*x+e)*(a+a*sec(f*x+e))^m,x, algorithm="giac")

[Out]

integrate((a*sec(f*x + e) + a)^m*cos(f*x + e), x)

Mupad [F(-1)]

Timed out. \[ \int \cos (e+f x) (a+a \sec (e+f x))^m \, dx=\int \cos \left (e+f\,x\right )\,{\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^m \,d x \]

[In]

int(cos(e + f*x)*(a + a/cos(e + f*x))^m,x)

[Out]

int(cos(e + f*x)*(a + a/cos(e + f*x))^m, x)